Using svn merge

I wanted to merge one revision I made in the trunk into one of the branches. So, I used Subversion’s svn merge command to accomplish this. Thanks to Ray M. for explained the Subversion merge command to me. Here are my notes:

Before I start, I identified the following information:

  • The target revision number in trunk that I wanted to merge into the branch. In this case, I assigned a revision number of 100.
  • The full URL for the trunk. I found this information by running svn info and looked for Repository Root. In my environment, the trunk is simply [Repository Root]/trunk.

With the above information, I was ready to do a dry-run to make sure the command produced the outcome I wanted. Here is what I ran:

cd [local branch directory]
svn merge -r99:100 --dry-run [Repository Root]/trunk

I basically changed directory into the branch where I want merge the trunk revision to. Next, I ran the svn command with the merge sub-command. For the revision numbers, I specified the revision I wanted to merge from the trunk as the second number and the first number was simply the second revision minus one. This essentially said to merge changes that happen between revision 99 and 100, which was equivalent to all the changes committed in revision 100. The URL to trunk told the merge sub-command where to look for the specified source revision number.

Once I was happy with the dry-out output, I ran the command again without the --dry-run option. This effectively merge revision 100 from trunk into the branch. Right after that, I ran svn diff to check if the diff output was what I expected before I commit the changes.

3 thoughts on “Using svn merge

  1. Hi Dave,

    My name is Zaid and I work for Packt Publishing. We are into publishing books based on Information Technology (I.T)

    I’m writing to you to bring to your notice, our recently published book ” TortoiseSVN 1.7 Beginner’s Guide”, Written by Lesley A. Harrison, this book will teach readers to use TortoiseSVN to master version control techniques without the need of version control theory.
    You can read more about this book at https://www.packtpub.com/tortoisesvn-1-7-beginners-guide/book

    I came across your blog one of my google searches and Considering your expertise in TortoiseSVN, I feel you’d be one of the best persons to review this book for us. Therefore your thoughts about this book would prove extremely valuable to us and to your readers and will be very much appreciated.
    In case this subject interests you and you’d be interested in writing a review for this book on your website, do let me know, and on your confirmation, I’d be more than happy to send you a copy of the book.

    In case you have any queries, do let me know and I’d be happy to assist.

    I look forward to hearing from you.

    Regards,

Leave a comment